import { defineStore } from 'pinia'
import {ComGenCodeService} from '@/api/module/ComGenCode.js'
import { useGlobalStore } from '@/stores/global.js'
import { ref } from 'vue'



export const useGenCodeStore = defineStore('genCode', () => {

  const globalStore = useGlobalStore();

  const genCodeApiState=ref(false);

  function genCode(){
    genCodeApiState.value=false;
    ComGenCodeService.genCode({
      projectId:globalStore.checkProjectId
    }).then(()=>{
      setTimeout(()=>{
        genCodeApiState.value=true;
      },1000)

    }).catch()


  }

  function DownCode(){

    ComGenCodeService.downCode({

    }).then(()=>{

    }).catch()

  }



  return {genCode,genCodeApiState,DownCode}
})
